package com.ls.controller.label;


import com.ls.controller.label.model.AddLabelModel;
import com.ls.controller.label.model.EditLabelModel;
import com.ls.controller.label.model.QueryLabelModel;
import com.ls.service.ILabelService;
import com.ls.utils.ResultData;
import io.swagger.annotations.Api;
import io.swagger.models.auth.In;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 标签表，与customer关联 前端控制器
 * </p>
 * 需要加一个标签表，用户和标签是一对多的关系
 * @author pengyu
 * @since 2024-11-20
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/labelApp")
@Api(value = "app标签", tags = "app标签")
public class LabelAppController {

    private final ILabelService service;

    /** 标签 */
    @GetMapping(value = "pageList")
    public ResultData pageList(QueryLabelModel model) {
        return service.pageList(model);
    }

    /** 新增标签 */
    @PostMapping(value = "add")
    public ResultData add(@Valid @RequestBody AddLabelModel model) {
        return service.add(model);
    }

    /** 编辑标签 */
    @PostMapping(value = "edit")
    public ResultData edit(@Valid @RequestBody EditLabelModel model) {
        return service.edit(model);
    }

    /** 删除标签 */
    @PostMapping(value = "del")
    public ResultData del(@RequestParam Integer labelId) {
        return service.del(labelId);
    }

}

